package com.econ.powercloud.ems.service.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.econ.powercloud.ems.dal.entity.EmsDevice;
import com.econ.powercloud.ems.dal.entity.EmsDeviceMonitorConfig;
import com.econ.powercloud.ems.dal.mapper.EmsDeviceMonitorConfigMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ Description:
 * @ Author：hgp
 * @ Create:2023-02-24-17:06
 */
@Repository
public class EmsDeviceMonitorConfigDAO extends ServiceImpl<EmsDeviceMonitorConfigMapper,EmsDeviceMonitorConfig> {

    public List<EmsDeviceMonitorConfig> getListByCondition(String stationId, Integer deviceType,Integer showType) {
        LambdaQueryWrapper<EmsDeviceMonitorConfig> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(StringUtils.isNotBlank(stationId),EmsDeviceMonitorConfig::getEnergyStationId,stationId);
        wrapper.eq(deviceType!=null,EmsDeviceMonitorConfig::getDeviceType,deviceType);
        wrapper.eq(showType!=null,EmsDeviceMonitorConfig::getShowType,showType);
        return this.baseMapper.selectList(wrapper);
    }
}
